package com.jin.jpa.wrapper;

import com.jin.jpa.wrapper.expression.WhereOpExpression;
import com.jin.jpa.wrapper.support.FieldFunction;
import com.jin.jpa.wrapper.support.IWrapper;

import java.util.List;

/**
 * @Author: yuanxiuyao
 * @Date: 2024/1/4 15:13
 * @Version 1.0
 */
public abstract class WrapperHandler<T> implements IWrapper<T> {

    protected IWrapper<T> iWrapper;

    public WrapperHandler(IWrapper<T> iWrapper){
        this.iWrapper = iWrapper;
    }

    @Override
    public IWrapper<T> orderByAsc(FieldFunction<T, ?> expression) {
        return iWrapper.orderByAsc(expression);
    }

    @Override
    public IWrapper<T> orderByDesc(FieldFunction<T, ?> expression) {
        return iWrapper.orderByDesc(expression);
    }

    @Override
    public IWrapper<T> groupBy(FieldFunction<T, ?> expression) {
        return iWrapper.groupBy(expression);
    }

    @Override
    public <R> R fetchOne() {
        return iWrapper.fetchOne();
    }

    @Override
    public <R> List<R> fetchList() {
        return iWrapper.fetchList();
    }

    @Override
    public T one() {
        return iWrapper.one();
    }

    @Override
    public List<T> list() {
        return iWrapper.list();
    }

    @Override
    public Class<T> getInstanceClass() {
        return iWrapper.getInstanceClass();
    }

    @Override
    public IWrapper<T> select(FieldFunction<T, ?> expression) {
        return iWrapper.select(expression);
    }

    @Override
    public IWrapper<T> selectMin(FieldFunction<T, ?> expression) {
        return iWrapper.selectMin(expression);
    }

    @Override
    public IWrapper<T> selectMax(FieldFunction<T, ?> expression) {
        return iWrapper.selectMax(expression);
    }

    @Override
    public WhereOpExpression<T> and() {
        return iWrapper.and();
    }

    @Override
    public WhereOpExpression<T> or() {
        return iWrapper.or();
    }

    @Override
    public WhereOpExpression<T> and(FieldFunction<T, ?> expression, Object value) {
        return iWrapper.and(expression, value);
    }

    @Override
    public WhereOpExpression<T> or(FieldFunction<T, ?> expression, Object value) {
        return iWrapper.or(expression, value);
    }

    @Override
    public WhereOpExpression<T> andNull(FieldFunction<T, ?> expression) {
        return iWrapper.andNull(expression);
    }

    @Override
    public WhereOpExpression<T> andNotNull(FieldFunction<T, ?> expression) {
        return iWrapper.andNotNull(expression);
    }

    @Override
    public WhereOpExpression<T> orNull(FieldFunction<T, ?> expression) {
        return iWrapper.orNull(expression);
    }

    @Override
    public WhereOpExpression<T> orNotNull(FieldFunction<T, ?> expression) {
        return iWrapper.orNotNull(expression);
    }

}
